@extends('layouts.layout')

@section('header')

    <title>首页</title>

    <link rel="stylesheet" type="text/css" href="{{URL::asset('static/css/index.css')}}"/>

@endsection

@section('content')
    <body>
    <div class="banner">
        <img src="{{URL::asset('uploads/'.$banner)}}">
    </div>
    <div class="tit">
        精选产品
    </div>
    <div class="main">
        <ul class="list">
            @foreach ($datas as $data)
                <li>
                    <a href="javascript:;" class="clearfix toGoods" data-info="{{ $data }}">
                        <div><img src="{{URL::asset('uploads/'.$data->goods_cover)}}" ></div>
                        <div>
                            <p class="ellipsis">{{ $data->goods_name }}</p>
                            <span>￥{{ $data->goods_prices }}</span>
                        </div>
                    </a>
                </li>
            @endforeach
        </ul>
    </div>

    <div class="footer">
        <div>
            <a href="javascript:;">
                <img src="{{URL::asset('static/img/selIndex.png')}}" alt="">
                <p style="color: #d81e06;">首页</p>
            </a>
        </div>
        <div>
            <a href="/user/my">
                <img src="{{URL::asset('static/img/my.png')}}" alt="">
                <p>我的</p>
            </a>
        </div>
    </div>

    </body>

@endsection

@section('script')
    <script type="text/javascript">
        $(function () {
            $(".toGoods").click(function () {
                var info = $(this).data("info")
                sessionStorage.setItem("goodsInfo", JSON.stringify(info))
                window.location.href = "/goods/detail"
            })
        })
    </script>

@endsection

